package demo.hashset;

import java.util.Objects;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-22
 */
public class Employee {
    private String name;
    private int age;

    public Employee(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        Employee obj = (Employee) o;
        return this.age==obj.getAge() && this.name==obj.getName();
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }
}
